<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp"%>
<%@include file="../common/jscss.jsp"%>


<style type="text/css">
    .l-table-edit {font-size: 12px;margin: auto;}
 	.l-table-edit-td{ padding:4px;}
    .l-button-submit,.l-button-test{width:80px; float:left; margin-left:10px; padding-bottom:2px;}
    .l-verify-tip{ left:230px; top:120px;}
    .error{color:red}
</style>

<form name="saveForm" method="post" action="/misc/company/saveCompany.htm" id="saveForm">
	
	<table cellpadding="0" cellspacing="0" class="l-table-edit">
		<tr>
			<td align="right" class="l-table-edit-td">
				公司名字:
			</td>
			<td align="left" class="l-table-edit-td">
				<input name="name" type="text" id="name"  ltype="text" validate="{required:true,minlength:1,maxlength:50}" />
			</td>
		</tr>
		<tr>
			<td align="right" class="l-table-edit-td">
				公司电话:
			</td>
			<td align="left" class="l-table-edit-td">
				<input name="phone" type="text" id="phone"  ltype="text" validate="{required:true,minlength:1,maxlength:50}" />
			</td>
		</tr>
		<tr>
			<td align="right" class="l-table-edit-td">
				公司地址:
			</td>
			<td align="left" class="l-table-edit-td">
				<input name="address" type="text" id="address"  ltype="text" validate="{required:true,minlength:1,maxlength:50}" />
			</td>
		</tr>
		<tr>
			<td align="right" class="l-table-edit-td">
				排序:
			</td>
			<td align="left" class="l-table-edit-td">
				<input name="sort" type="text" id="sort"  ltype="text" validate="{required:true,minlength:1,maxlength:50}" />
			</td>
		</tr>
		<tr>
			<td align="right" class="l-table-edit-td">
				公司简介:
			</td>
			<td align="left" class="l-table-edit-td">
				<textarea name="intro" style="width: 300px;height: 200px;"></textarea>
			</td>
		</tr>
	</table>
	<br />
	<input type="submit" value="保存" id="Button1" class="l-button l-button-submit" />
	<input type="button" value="取消" class="l-button l-button-test" onclick="javascript:parent.dialog_ae.close();"/>
</form>


<script type="text/javascript">
$(function() {
	
    
    
    $.metadata.setType("attr", "validate");
	$("#saveForm").validate({
		 errorPlacement: function (lable, element){
             if (element.hasClass("l-textarea")){
                 element.ligerTip({ content: lable.html(), target: element[0] }); 
             }else if (element.hasClass("l-text-field")){
                 element.parent().ligerTip({ content: lable.html(), target: element[0] });
             }else{
                 lable.appendTo(element.parents("td:first").next("td"));
             }
         },
         success: function (lable){
             lable.ligerHideTip();
             lable.remove();
         },
		submitHandler : function(form) {
        	 $(form).ajaxSubmit({
				dataType : 'text',
				cache : false,
				success : function(data) {
					if(IsNull(data)){
						alert("上传图片失败，请重新上传！");
					}else{
						parent.grid_ae.loadData();
						parent.dialog_ae.close();
					}
					
				},
				error : function(err) {
				//	alert(err);
				}
			});
			return false;
			
			
		}
	});
});


</script>
